{% set titles = provider.column_titles(handler) %}
{% set primary_key = provider.primary_key(handler) %}
<div class="box" id="{{table_id}}_listtable_box">
    <div class="box-body">
        <div class="row">
            {% if provider.show_add_button(handler) %}
            <div class="col-xs-12" style="padding-bottom:10px;">
                <button type="button" class="btn btn-primary pull-right" id="{{table_id}}_listtable_add_btn">新增</button>
            </div>
            {% end %}
            <div class="col-xs-12">
                <table id="{{table_id}}" class="table table-bordered table-hover dataTable" role="grid">
                    <thead>
                    <tr>
                        {% if primary_key %}
                        <th><input type="checkbox" onclick="bo_datatables_sel_all(this);"
                                   class="bo_datatables_row_checkbox" data-table-id="{{table_id}}"/>
                        </th>
                        {% end %}
                        {% for title in titles %}
                        <th>{{title}}</th>
                        {% end %}
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        {% if primary_key %}
                        <th><input type="checkbox" onclick="bo_datatables_sel_all(this);"
                                   class="bo_datatables_row_checkbox" data-table-id="{{table_id}}"/>
                        </th>
                        {% end %}
                        {% for title in titles %}
                        <th>{{title}}</th>
                        {% end %}
                    </tr>
                    </tfoot>
                </table>
            </div>

        </div>
    </div>
</div>
{% set _forms = provider.forms(handler) %}
{% if _forms %}
<div class="box" id="{{table_id}}_forms_box" style="display:none;">
    <div class="box-body">
        <form id="{{table_id}}_forms">
            {% module BoForm(_forms, provider.form_titles(handler), provider.form_layouts(handler)) %}
            {% raw provider.forms_footer(handler) %}
            <input name="{{primary_key}}" class="form-control" type="hidden" value=""/>
            <input name="bo_listtable_behavior" type="hidden" value="do-data-save"/>
            {% module xsrf_form_html() %}
        </form>
    </div>
    {% set before_from_data_save_cb = provider.before_from_data_save_cb(handler) %}
    {% set after_from_data_save_cb = provider.after_from_data_save_cb(handler) %}
    <div class="box-footer" data-before-save="{{before_from_data_save_cb}}"
         data-after-save="{{after_from_data_save_cb}}">
        {% if provider.show_save_and_exit_button(handler) %}
        <button type="button" class="btn btn-primary pull-right" style="margin-left:10px;"
                id="{{table_id}}_forms_save_and_exit_btn">保存退出
        </button>
        {% end %}
        {% if provider.show_save_and_edit_button(handler) %}
        <button type="button" class="btn btn-primary pull-right" style="margin-left:10px;"
                id="{{table_id}}_forms_save_and_edit_btn">保存并继续编辑
        </button>
        {% end %}
        {% if provider.show_save_and_new_button(handler) %}
        <button type="button" class="btn btn-primary pull-right" id="{{table_id}}_forms_save_and_new_btn">保存并继续新增
        </button>
        {% end %}
    </div>
</div>
{% end %}